﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;

using SIPO.Library.DomainObject.Administration;
using SIPO.Library.DataAccess.Administration;
using SIPO.Library.DomainObject.Transaction;
using SIPO.Library.DataAccess.Transaction;
using SIPO.Library.DataAccess.Administration.Catalog;
using SIPO.Library.DomainObject.Administration.Catalog;
using SIPO.Library.DataAccess.Report;


//namespace SIPO.Web.Reports.Transaction
//{
//    public partial class recDaftarRegistrasiDebitur : BasePage
//    {
//        private int id = -1;
//        private void Disabled()
//        {
            
//        }

//        protected override void OnLoad(EventArgs e)
//        {
//            if (Request.Params["id"] != null)
//            {
//                id = Convert.ToInt32(Request.Params["id"]);
//            }

//            if (!Page.IsPostBack)
//            {
//                recSectorRepo sektor = new recSectorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
//                recSubSectorRepo subsektor = new recSubSectorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
//                recSubSubSectorRepo subsubsektor = new recSubSubSectorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
//            }

//            base.OnLoad(e);
//        }
//    }
//}


public partial class reports_Transaction_rptDaftarRegistrasiDebitur : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        txtTahun.Text = DateTime.Now.Year.ToString();


        if (!IsPostBack)
        {
            recSectorRepo sektor = new recSectorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
            recSubSectorRepo subsektor = new recSubSectorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
            recSubSubSectorRepo subsubsektor = new recSubSubSectorRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);

            recSector rsektor = new recSector();
            recSubSector rsubsektor = new recSubSector();
            recSubSubSector rsubsubsektor = new recSubSubSector();

            List<recSector> lsektor = sektor.GetList();
            List<recSubSector> lsubsektor = subsektor.GetList();
            List<recSubSubSector> lsubsubsektor = subsubsektor.GetList();
            #region sektor
            ddlSektor.Items.Clear();
            if (lsektor.Count > 0)
            {
                lsektor.ForEach(delegate(recSector lsector)
                {
                    ddlSektor.Items.Add(new ListItem(lsector.SectorID + " - " + lsector.SectorName, lsector.SectorID.ToString()));
                });
            }
            ddlSektor.Items.Insert(0, new ListItem("-- Pilih Sektor --", string.Empty));
            #endregion sektor

            #region subsektor
            ddlSubSektor.Items.Clear();
            if (lsubsektor.Count > 0)
            {
                lsubsektor.ForEach(delegate(recSubSector lsubsector)
                {
                    ddlSubSektor.Items.Add(new ListItem(lsubsector.SubSectorID + " - " + lsubsector.SubSectorName, lsubsector.SubSectorID.ToString()));
                });
            }

            ddlSubSektor.Items.Insert(0, new ListItem("-- Pilih Sub Sektor --", string.Empty));
            #endregion subsubsektor

            #region subsubsektor
            ddlSubSubSektor.Items.Clear();
            if (lsubsubsektor.Count > 0)
            {
                lsubsubsektor.ForEach(delegate(recSubSubSector lsubsubsector)
               {
                   ddlSubSubSektor.Items.Add(new ListItem(lsubsubsector.SubSubSectorID + " - " + lsubsubsector.SubSubSectorName, lsubsubsector.SubSubSectorID.ToString()));
               });
            }
            ddlSubSubSektor.Items.Insert(0, new ListItem("-- Pilih Sub Sub Sektor --", string.Empty));
            #endregion subsubsektor

            
        }
    }
}